package com.anche.demo.util;

import java.util.Random;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Classname ThreadPoolExcuteUtil
 * @Description TODO
 * @Date 2023/1/5 22:53
 * @Created by Administrator
 */
public class ThreadPoolExcuteUtil {
    public final static ThreadPoolExecutor executor = new ThreadPoolExecutor(4, 8, 5, TimeUnit.SECONDS,
            new LinkedBlockingDeque<>(), r -> {
        Thread thread = new Thread(r);
        thread.setName("async-"+ thread.getName());
        thread.setDaemon(true);
        return thread;
    });
}